﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZG_member;
using System.Net;

namespace ZG_member.Receiving
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://sdk2.entinfo.cn:8060/webservice.asmx");
                HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
                if (resp.StatusCode == HttpStatusCode.OK)
                {
                    resp.Close();
                    this.timer1.Start();
                }
                else
                {

                }
            }
            catch (WebException webex)
            {
                //this.timer5.Stop();
                this.Text = "由于计算机未连网，无法接收短信！";
                MessageBox.Show("由于您的计算机未连网！将无法接受短信！");
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            ZG_member.SendMsgsForm smf = new ZG_member.SendMsgsForm();
            smf.shouxin();
        }

        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
        {

            if (this.Visible == false)
                this.Visible = true;
            this.WindowState = FormWindowState.Normal;
            this.notifyIcon1.Visible = true;
            //panel1.Visible = false;
        }

        private void Form1_SizeChanged(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Minimized)
            {

                this.notifyIcon1.Visible = true;
                this.Visible = false;
                // MessageBoxTimeout.Show("自动打印已开启", "系统提示", 1000);
            }
        }
    }
}
